Skip to content

Conversation

silvekkk
Copy link
Contributor

@silvekkk silvekkk commented Oct 6, 2025

When developing with forge test --watch, running all tests on every file change can be slow . Adds a --rerun-failed flag that automatically reruns only previously failed tests when files change, falling back to normal watch behavior once failures are resolved.

The flag use the existing test failure tracking mechanism (cache/test-failures file) when tests fail. When enabled, watch mode checks if this file exists and automatically adds --rerun to the command, otherwise it proceeds with the standard file-based test filtering.

For example, in a project with 80 tests where 3 are failing, this reduces iteration time from ~2 minutes to ~6 seconds per change, making watch mode practical for TDD workflows where you're iterating on fixing specific test failures.

Usage: forge test --watch --rerun-failed

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, I think that's a really nice improvement

@grandizzy grandizzy enabled auto-merge (squash) October 10, 2025 07:57
@grandizzy grandizzy merged commit 8dffbdc into foundry-rs:master Oct 10, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants